home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / recode.lha / recode-3.2.4 / configure < prev    next >
Text File  |  1992-09-29  |  10KB  |  380 lines

  1.  
  2. #!/bin/sh
  3. # Guess values for system-dependent variables and create Makefiles.
  4. # Generated automatically using autoconf.
  5. # Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  6.  
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2, or (at your option)
  10. # any later version.
  11.  
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU General Public License for more details.
  16.  
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  22. #        [--prefix=PREFIX] [--exec_prefix=PREFIX] [--with-PROGRAM] [TARGET]
  23. # Ignores all args except --srcdir, --prefix, --exec_prefix, and --no-create.
  24.  
  25. trap 'rm -f conftest* core; exit 1' 1 3 15
  26.  
  27. for arg
  28. do
  29.   # Handle --exec_prefix with a space before the argument.
  30.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  31.   # Handle --host with a space before the argument.
  32.   elif test x$next_host = xyes; then next_host=
  33.   # Handle --prefix with a space before the argument.
  34.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  35.   # Handle --srcdir with a space before the argument.
  36.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  37.   else
  38.     case $arg in
  39.      -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=*)
  40.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  41.      -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e)
  42.     next_exec_prefix=yes ;;
  43.  
  44.      -gas | --gas | --ga | --g) ;;
  45.  
  46.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  47.      -host | --host | --hos | --ho | --h)
  48.     next_host=yes ;;
  49.  
  50.      -nfp | --nfp | --nf) ;;
  51.  
  52.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  53.         no_create=1 ;;
  54.  
  55.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  56.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  57.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  58.     next_prefix=yes ;;
  59.  
  60.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  61.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  62.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  63.     next_srcdir=yes ;;
  64.  
  65.      -with-* | --with-*) ;;
  66.  
  67.      *) ;;
  68.     esac
  69.   fi
  70. done
  71.  
  72. rm -f conftest*
  73. compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  74.  
  75. # A filename unique to this package, relative to the directory that
  76. # configure is in, which we can look for to find out if srcdir is correct.
  77. unique_file=recode.c
  78.  
  79. # Find the source files, if location was not specified.
  80. if test -z "$srcdir"; then
  81.   srcdirdefaulted=yes; srcdir=.
  82.   if test ! -r $unique_file; then srcdir=..; fi
  83. fi
  84. if test ! -r $srcdir/$unique_file; then
  85.   if test x$srcdirdefaulted = xyes; then
  86.     echo "configure: Can not find sources in \`.' or \`..'." 1>&2
  87.   else
  88.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  89.   fi
  90.   exit 1
  91. fi
  92. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  93. # But we can't avoid them for `..', to make subdirectories work.
  94. case $srcdir in
  95.   .|/*|~*) ;;
  96.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  97. esac
  98.  
  99. # Default code is latin1 on UNIX, ibmpc on MSDOS.
  100. DEFAULTCODE=${DEFAULTCODE-latin1}
  101. for p in mawk gawk nawk awk
  102. do
  103. if test -z "$AWK"; then
  104.   echo checking for $p
  105.   saveifs="$IFS"; IFS="${IFS}:"
  106.   for dir in $PATH; do
  107.     test -z "$dir" && dir=.
  108.     if test -f $dir/$p; then
  109.       AWK="$p"
  110.       break
  111.     fi
  112.   done
  113.   IFS="$saveifs"
  114. fi
  115. test -z "$AWK" && AWK=""
  116.  
  117. test -n "$AWK" && break
  118. done
  119.  
  120. if test -z "$LEX"; then
  121.   echo checking for flex
  122.   saveifs="$IFS"; IFS="${IFS}:"
  123.   for dir in $PATH; do
  124.     test -z "$dir" && dir=.
  125.     if test -f $dir/flex; then
  126.       LEX="flex"
  127.       break
  128.     fi
  129.   done
  130.   IFS="$saveifs"
  131. fi
  132. test -z "$LEX" && LEX="lex"
  133.  
  134. if test -z "$LEXLIB"
  135. then
  136.   case "$LEX" in
  137.   flex*)
  138.     if test -r /usr/local/lib/libfl.a
  139.     then LEXLIB=/usr/local/lib/libfl.a
  140.     elif test -r ${prefix}/lib/libfl.a
  141.     then LEXLIB=${prefix}/lib/libfl.a
  142.     else LEXLIB="-lfl"
  143.     fi
  144.     ;;
  145.   *) LEXLIB="-ll" ;;
  146.   esac
  147. fi
  148. test "$LEX" = flex || echo >&2 "WARNING: Cannot find Flex"
  149.  
  150. if test -z "$CC"; then
  151.   echo checking for gcc
  152.   saveifs="$IFS"; IFS="${IFS}:"
  153.   for dir in $PATH; do
  154.     test -z "$dir" && dir=.
  155.     if test -f $dir/gcc; then
  156.       CC="gcc"
  157.       break
  158.     fi
  159.   done
  160.   IFS="$saveifs"
  161. fi
  162. test -z "$CC" && CC="cc"
  163.  
  164. # Find out if we are using GNU C, under whatever name.
  165. cat <<EOF > conftest.c
  166. #ifdef __GNUC__
  167.   yes
  168. #endif
  169. EOF
  170. ${CC-cc} -E conftest.c > conftest.out 2>&1
  171. if egrep yes conftest.out >/dev/null 2>&1; then
  172.   GCC=1 # For later tests.
  173.   CC="$CC -O"
  174. fi
  175. rm -f conftest*
  176.  
  177. if test -z "$RANLIB"; then
  178.   echo checking for ranlib
  179.   saveifs="$IFS"; IFS="${IFS}:"
  180.   for dir in $PATH; do
  181.     test -z "$dir" && dir=.
  182.     if test -f $dir/ranlib; then
  183.       RANLIB="ranlib"
  184.       break
  185.     fi
  186.   done
  187.   IFS="$saveifs"
  188. fi
  189. test -z "$RANLIB" && RANLIB="@:"
  190.  
  191. # Make sure to not get the incompatible SysV /etc/install and
  192. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  193. # or the SunOS /usr/etc/install directory.
  194. if test -z "$INSTALL"; then
  195.   echo checking for install
  196.   saveifs="$IFS"; IFS="${IFS}:"
  197.   for dir in $PATH; do
  198.     test -z "$dir" && dir=.
  199.     case $dir in
  200.     /etc|/usr/sbin|/usr/etc) ;;
  201.     *)
  202.       if test -f $dir/install; then
  203.     INSTALL="$dir/install -c"
  204.     INSTALL_PROGRAM='$(INSTALL)'
  205.     INSTALL_DATA='$(INSTALL) -m 644'
  206.     break
  207.       fi
  208.       ;;
  209.     esac
  210.   done
  211.   IFS="$saveifs"
  212. fi
  213. INSTALL=${INSTALL-cp}
  214. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  215. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  216.  
  217. echo checking for POSIXized ISC
  218. if test -d /etc/conf/kconfig.d &&
  219.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  220. then
  221.   ISC=1 # If later tests want to check for ISC.
  222.   DEFS="$DEFS -D_POSIX_SOURCE=1"
  223.   if test -n "$GCC"; then
  224.     CC="$CC -posix"
  225.   else
  226.     CC="$CC -Xp"
  227.   fi
  228. fi
  229.  
  230. echo checking if __STDC__ defined
  231. echo checking how to run the C preprocessor
  232. if test -z "$CPP"; then
  233.   CPP='${CC-cc} -E'
  234.   cat <<EOF > conftest.c
  235.  
  236. #include <stdio.h>
  237. EOF
  238. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  239. if test -z "$err"; then
  240.   :
  241. else
  242.   CPP=/lib/cpp
  243. fi
  244. rm -f conftest*
  245. fi
  246.  
  247. cat <<EOF > conftest.c
  248.  
  249. #ifdef __STDC__
  250. #include <nonexistent.h>
  251. #endif
  252. EOF
  253. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  254. if test -z "$err"; then
  255.   U=_
  256. fi
  257. rm -f conftest*
  258. echo checking for ANSI C header files
  259. cat <<EOF > conftest.c
  260.  
  261. #include <stdlib.h>
  262. #include <stdarg.h>
  263. #include <string.h>
  264. #include <limits.h>
  265. EOF
  266. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  267. if test -z "$err"; then
  268.   DEFS="$DEFS -DSTDC_HEADERS=1"
  269. fi
  270. rm -f conftest*
  271.  
  272. echo checking for BSD string and memory functions
  273. echo "#include <strings.h>
  274. main() { exit(0); } t() { rindex(0, 0); bzero(0, 0); }" > conftest.c
  275. if eval $compile; then
  276.   :
  277. else
  278.   DEFS="$DEFS -DUSG=1"
  279. fi
  280. rm -f conftest*
  281.  
  282. # Add `pipe' to the following list whenever I correct *that* bug.
  283. for func in dup2 popen rename
  284. do
  285. trfrom='[a-z]' trto='[A-Z]'
  286. echo checking for ${func}
  287. echo "
  288. main() { exit(0); } t() { 
  289. /* Override any gcc2 internal prototype to avoid an error.  */
  290. extern char ${func}(); ${func}(); }" > conftest.c
  291. if eval $compile; then
  292.   DEFS="$DEFS -DHAVE_`echo $func|tr "$trfrom" "$trto"`=1"
  293. fi
  294. rm -f conftest*
  295. done
  296.  
  297. if test -n "$prefix"; then
  298.   test -z "$exec_prefix" && exec_prefix='$(prefix)'
  299.   prsub="s,^prefix[     ]*=.*$,prefix = $prefix,"
  300. fi
  301. if test -n "$exec_prefix"; then
  302.   prsub="$prsub
  303. s,^exec_prefix[     ]*=.*$,exec_prefix = $exec_prefix,"
  304. fi
  305.  
  306. trap 'rm -f config.status; exit 1' 1 3 15
  307. echo creating config.status
  308. rm -f config.status
  309. cat <<EOF > config.status
  310. #!/bin/sh
  311. # Generated automatically by configure.
  312. # Run this file to recreate the current configuration.
  313. # This directory was configured as follows:
  314. # $0 $*
  315.  
  316. case "\$1" in
  317.   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  318.   exec /bin/sh $0 $* ;;
  319. esac
  320.  
  321. trap 'rm -f Makefile; exit 1' 1 3 15
  322. LDEFS='$LDEFS'
  323. LIBOBJS='$LIBOBJS'
  324. DEFAULTCODE='$DEFAULTCODE'
  325. AWK='$AWK'
  326. LEX='$LEX'
  327. LEXLIB='$LEXLIB'
  328. CC='$CC'
  329. RANLIB='$RANLIB'
  330. INSTALL='$INSTALL'
  331. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  332. INSTALL_DATA='$INSTALL_DATA'
  333. CPP='$CPP'
  334. U='$U'
  335. LIBS='$LIBS'
  336. srcdir='$srcdir'
  337. DEFS='$DEFS'
  338. prefix='$prefix'
  339. exec_prefix='$exec_prefix'
  340. prsub='$prsub'
  341. EOF
  342. cat <<\EOF >> config.status
  343.  
  344. top_srcdir=$srcdir
  345. for file in Makefile; do
  346.   srcdir=$top_srcdir
  347.   # Remove last slash and all that follows it.  Not all systems have dirname.
  348.   dir=`echo $file|sed 's,/[^/][^/]*$,,'`
  349.   if test "$dir" != "$file"; then
  350.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  351.     test ! -d $dir && mkdir $dir
  352.   fi
  353.   echo creating $file
  354.   rm -f $file
  355.   echo "# Generated automatically from `basename $file`.in by configure." > $file
  356.   sed -e "
  357. $prsub
  358. s,@LDEFS@,$LDEFS,g
  359. s,@LIBOBJS@,$LIBOBJS,g
  360. s,@DEFAULTCODE@,$DEFAULTCODE,g
  361. s,@AWK@,$AWK,g
  362. s,@LEX@,$LEX,g
  363. s,@LEXLIB@,$LEXLIB,g
  364. s,@CC@,$CC,g
  365. s,@RANLIB@,$RANLIB,g
  366. s,@INSTALL@,$INSTALL,g
  367. s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,g
  368. s,@INSTALL_DATA@,$INSTALL_DATA,g
  369. s,@CPP@,$CPP,g
  370. s,@U@,$U,g
  371. s,@LIBS@,$LIBS,g
  372. s,@srcdir@,$srcdir,g
  373. s,@DEFS@,$DEFS," $top_srcdir/${file}.in >> $file
  374. done
  375.  
  376. EOF
  377. chmod +x config.status
  378. test -n "$no_create" || ./config.status
  379.  
  380.